package com.skyolder.crutch.ast;

import com.skyolder.crutch.error.GrammarError;
import com.skyolder.crutch.error.RunError;
import com.skyolder.crutch.ev.Environment;
import com.skyolder.crutch.word.TokenQueue;
import com.skyolder.crutch.word.token.SymbolToken;
import com.skyolder.crutch.word.token.Token;
import com.skyolder.crutch.word.types.SymbolType;

public class EmptyTree implements Tree {
	Environment parentEnvironment = null;
	TokenQueue tokenQueue = null;
	public EmptyTree(Environment environment, TokenQueue tokenQueue) {
		this.parentEnvironment = environment;
		this.tokenQueue = tokenQueue;
	}
	@Override
	public void build() throws GrammarError {
		Token token=tokenQueue.peekToken();
		if(token instanceof SymbolToken){
			SymbolToken symbolToken=(SymbolToken)token;
			if(symbolToken.getSymbolType()==SymbolType.SEMICOLON){
				tokenQueue.nextToken();
				return;
			}
		}
		throw new GrammarError(token.toString());
	}

	@Override
	public void excute() throws RunError {
		return;
	}
}
